import unittest

from parameterized import parameterized

from api.ihrm_login_api import IhrmloginAPI
from common.assert_util import common_assert
from common.read import get_list

class Testihrmlogin(unittest.TestCase):
    @parameterized.expand(get_list())
    def testlogin(self,json_data,status_code,code,success,message):
        resp = IhrmloginAPI.ihrm_login(json_data)
        common_assert(self,resp,status_code,code,success,message)



#
class Testihrmlogin(unittest.TestCase):
    def testlogin_success(self):
        json_data = {"mobile":"13800000002","password":"123456"}
        resp = IhrmloginAPI.ihrm_login(json_data)
        # self.assertEqual(200,resp.status_code)
        # self.assertEqual(10000,resp.json().get("code"))
        # self.assertEqual(True,resp.json().get("success"))
        # self.assertIn("操作成功",resp.json().get("message"))
        common_assert(self,resp,200,10000,True,"操作成功")

#     def testlogin_nomobile(self):
#         json_data = {"mobile": "13800005672", "password": "123456"}
#         resp = IhrmloginAPI.ihrm_login(json_data)
#         # self.assertEqual(200, resp.status_code)
#         # self.assertEqual(20001, resp.json().get("code"))
#         # self.assertEqual(False, resp.json("success"))
#         # self.assertIn("用户名或密码错误", resp.json().get("message"))
#         common_assert(self,resp,200,20001,False,"用户名或密码错误")
#
#     def testlogin_nopwd(self):
#         json_data = {"mobile": "13800000002", "password": "12345678"}
#         resp = IhrmloginAPI.ihrm_login(json_data)
#         # self.assertEqual(200, resp.status_code)
#         # self.assertEqual(20001, resp.json().get("code"))
#         # self.assertEqual(False, resp.json("success"))
#         # self.assertIn("用户名或密码错误", resp.json().get("message"))
#         common_assert(self, resp, 200, 20001, False, "用户名或密码错误")
#
#     def testlogin_morecan(self):
#         json_data = {"mobile":"13800000002","password":"123456","abc":"8888"}
#         resp = IhrmloginAPI.ihrm_login(json_data)
#         # self.assertEqual(200,resp.status_code)
#         # self.assertEqual(10000,resp.json().get("code"))
#         # self.assertEqual(True,resp.json("success"))
#         # self.assertIn("操作成功",resp.json().get("message"))
#         common_assert(self, resp, 200, 10000, True, "操作成功")